<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="cn.com.codes.common.util.StringUtils"%>
<%@page import="cn.com.codes.framework.security.VisitUser"%>
<%@page import="cn.com.codes.framework.security.Visit"%>
<%@page import="cn.com.codes.framework.security.filter.SecurityContextHolder"%>
<%@page import="cn.com.codes.framework.security.filter.SecurityContext"%>

<%
	SecurityContext sc = SecurityContextHolder.getContext();
	Visit visit = sc.getVisit();
	VisitUser user = visit.getUserInfo(VisitUser.class);
	
	String accountId = (null != user.getId()) ? user.getId() : "";
	String loginName = (null != user.getLoginName()) ? user.getLoginName() : "";
	String userName = (null != user.getName()) ? user.getName() : "";
	String currTaksId = visit.getTaskId();
	if (StringUtils.isNullOrEmpty(userName)) {
		userName = loginName;
	}
%>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/itest/css/apiManager/interfaceManage.css"/>

<div class="exui-layout" style="width:100%;height:100%;">
	<div data-options="region:'west'" title="<div><span>测试需求  &nbsp;</span><!-- <a href='#' class='exui-linkbutton'>普通视图(双击切换)</a> --></div>" style="width:230px;padding:10px;overflow-y:auto;">
		<ul id="caseTree" class="exui-tree"></ul>
	</div>
	<div data-options="region:'center'" style="overflow:hidden;">
		<div class="tools">
			<div class="input-field" style="width: 220px;">
				<span style="color:#1E7CFB;left:10px;">快速查询：</span>
				<input id="interfaceName" class="form-control indent-4-5" style="border: 1px solid #1E7CFB;" placeholder="接口名称+回车键"/>
			</div>
			<button type="button" class="btn btn-default bntcss hoverBu" style="padding:6.5px;display:none" onclick="showAddInterfaceWin();" schkUrl="interfaceAction!addInterface.action"><i class="glyphicon glyphicon-plus"></i>增加</button>
			<button type="button" class="btn btn-default bntcss hoverBu" style="padding:6.5px;display:none" onclick="showEditInterfaceWin();" schkUrl="interfaceAction!editInterface.action"><i class="glyphicon glyphicon-pencil"></i>修改</button>
			<!-- <button type="button" class="btn btn-default bntcss hoverBu" style="padding:6.5px" onclick="copyInterface();" schkUrl="interfaceAction!copy"><i class="glyphicon glyphicon-copy"></i>复制</button> -->
			<!-- <button type="button" class="btn btn-default bntcss hoverBu" style="padding:6.5px" onclick="cutInterface();" schkUrl="interfaceAction!cut"><i class="glyphicon glyphicon-scissors"></i>剪切</button>
			<button id="paste" type="button" class="btn btn-default bntcss hoverBu" style="display: none;padding:6.5px" onclick="pasteInterface();"><i class="glyphicon glyphicon-paste"></i>粘贴</button> -->
			<button type="button" class="btn btn-default bntcss hoverBu" style="padding:6.5px;display:none" onclick="delInterface();" schkUrl="interfaceAction!batchDelete.action" ><i class="glyphicon glyphicon-remove"></i>删除</button>
			<!-- <button type="button" class="btn btn-default bntcss hoverBu" style="padding:9.5px 18px;" onclick="testerWorkInfo();" schkUrl="caseManagerAction!loadCaseBoard" title="项目人员工作面板" ><i class="glyphicon glyphicon-user"></i></button>
			<button type="button" class="btn btn-default bntcss hoverBu" style="padding:9.5px 18px;" onclick="toLibrary();" title="推荐到用例库"><i class="glyphicon glyphicon-hand-right"></i></button> -->
			<!-- <button type="button" class="btn btn-default bntcss hoverBu" style="padding:9.5px 18px;" onclick="upload();" title="导入接口(同步线下处理)"><i class="glyphicon glyphicon-arrow-up"></i></button>
			<a href="#" type="button" class="btn btn-default bntcss hoverBu" style="padding:9.5px 18px;" onclick="download(this);" title="导出接口(线下处理)"><i class="glyphicon glyphicon-arrow-down"></i></a> -->
			<div class="dropdown" style="margin-left:2px">
				<button id="dropdownMenu" type="button" class="btn btn-default bntcss hoverBu" style="padding:6.5px" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">全局设置&nbsp;&nbsp;<span class="caret"></span></button>
  				<ul class="dropdown-menu" aria-labelledby="dropdownMenu">
  					<li><a href="#" onclick="showEnvVar()">环境变量</a></li>
  					<li><a href="#" onclick="showBaseUrl()">baseURL</a></li>
  					<li><a href="#" onclick="showGlobalAuth()">认证设置</a></li>
    				<li><a href="#" onclick="showHttpParams()">全局参数</a></li>
    				<li><a href="#" onclick="showResponseCheck()">响应校验</a></li>
  				</ul>
			</div>
			<button type="button" style="display:none" class="btn btn-primary bntsearchcss pos" onclick="quickQuery();" schkUrl="interfaceAction!page.action" ><i class="glyphicon glyphicon-search"></i>查询...</button>
		</div>
		<table id="interfaceList" class="exui-datagrid" style="width:100%;height: auto;"></table>
	</div>
</div>

<!-- 查询模态窗 -->
<div id="queryWin" class="exui-window" data-options="
	modal:true,
	width:640,
	footer: '#queryFoot',
	minimizable:false,
	maximizable:false,
	closed:true">
	<form id="queryForm">
		<table class="form-table">
			<tr>
				<td style="text-align:right">接口名称：</td>
				<td colspan="3">
					<input name="dto.apiInterface.interfaceName" class="exui-textbox" style="width:100%;" data-options="prompt:'接口名称'" />
				</td>
			</tr>
			<tr>
				<td style="text-align:right">请求数据类型：</td>
				<td>
					<input class="exui-combobox" name="dto.apiInterface.dataType" style="width:250px" data-options="
						editable:false,
						valueField:'value',
						textField:'label',
						value:'X-WWW-FORM-URLENCODED',
						data:[{
							label:'X-WWW-FORM-URLENCODED',value:'X-WWW-FORM-URLENCODED'
						}, {
							label:'JSON',value:'JSON'
						}, {
							label:'FORM-DATA',value:'FORM-DATA'
						}, {
							label:'RAW',value:'RAW'
						}, {
							label:'XML',value:'XML'
						}]"/>
				</td>
				<td style="text-align:right;padding-left:20px">响应数据类型：</td>
				<td>
					<input class="exui-combobox" name="dto.apiInterface.contentType" style="width:100px" data-options="
					editable:false,
					valueField:'value',
					textField:'label',
					value:'JSON',
					data:[{
						label:'JSON',value:'JSON'
					}, {
						label:'TEXT',value:'TEXT'
					}, {
						label:'XML',value:'XML'
					}, {
						label:'HTML',value:'HTML'
					}]"/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right">编写人：</td>
				<td colspan="3">
					<input name="dto.apiInterface.authorName" class="exui-textbox" style="width:100%;" data-options="prompt:'编写人'" />
   			    </td>
			</tr>
		</table>
	</form>
</div>
<div id="queryFoot" align="right">
	<a href="javascript:;" class="exui-linkbutton" data-options="toggle:true,group:'g1',btnCls:'primary',size:'xs'" onclick="querySubmit()">查询</a>
	<a href="javascript:;" class="exui-linkbutton bntcss" data-options="toggle:true,group:'g1',size:'xs'" onclick="clearQueryForm()">清空</a>
	<a href="javascript:;" class="exui-linkbutton bntcss" data-options="toggle:true,group:'g1',size:'xs'" onclick="closeQueryWin()">返回</a>
</div>
<script src="<%=request.getContextPath()%>/itest/js/apiManager/interfaceManager/interfaceManage.js" type="text/javascript" charset="utf-8"></script>